https://leetcode.cn/problems/subarray-sums-divisible-by-k/description/
同于定理  (a-b)/p=k...0  a%p=b%p (a-b)%k=0 ->a%k=b%k
class Solution {
public:
    int subarraysDivByK(vector<int>& nums, int k) {
        int n=nums.size(),sum=0,ret=0;
        unordered_map<int,int> hash;
        hash[0%k]=1;
        for(int i=0;i<n;i++)
        {
            sum+=nums[i];
            int remaind=(sum%k+k)%k;
            if(hash.count(remaind))
                ret+=hash[remaind];
            hash[remaind]++;
        }
        return ret;
    }
};